import React, { Suspense, useState } from "react";
import { BrowserRouter, useRoutes } from 'react-router-dom'
import { routes } from './router/index'
import { MyContext } from './context/index'
const RouterView = () => {
    return useRoutes(routes)
}

const Index = () => {
    const [carList, setCarList] = useState([1,2,3,4,5])
    return (
        <MyContext.Provider value={{ carList, setCarList }}>
            <BrowserRouter>
                <Suspense>
                    <RouterView></RouterView>
                </Suspense>
            </BrowserRouter>
        </MyContext.Provider>

    )

}

export default Index